package com.juli.school.app.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.juli.school.dao.entity.AnswerDetails;
import com.juli.school.service.bo.AnswerDetailsBo;
import com.juli.school.service.impl.AnswerDetailsService;
import com.juli.school.utils.core.model.CommonResp;

/**
 * 心理测试答题情况
 * @author wjp
 * @date 2017年10月5日
 *
 */
@RequestMapping("answerDetails")
@Controller
public class AnswerDetailsController {
	
	@Resource
	private AnswerDetailsService answerDetailsService;
	
	/**
	 * 添加一条答题情况
	 * 
	 * @param love
	 * @return
	 */
	@RequestMapping(value = "add", method = RequestMethod.POST)
	@ResponseBody
	public CommonResp<Boolean> add(AnswerDetailsBo answerDetailsBo) {
		return answerDetailsService.add(answerDetailsBo);
	}
	
	/**
	 * 修改一条答题情况
	 * 
	 * @param love
	 * @return
	 */
	@RequestMapping("update")
	@ResponseBody
	public CommonResp<Boolean> update(AnswerDetailsBo answerDetailsBo) {
		return answerDetailsService.update(answerDetailsBo);
	}
	
	/**
	 * 删除一条答题情况记录
	 * 
	 * @param snStamp
	 * @return
	 */
	@RequestMapping("delete")
	@ResponseBody
	public CommonResp<Boolean> delete(String snStamp, String stuId) {
		return answerDetailsService.delete(snStamp, stuId);
	}
	
	/**  
	 * @Description： 根据心理测试编号和学生ID获取答题情况详情
	 * @author: hantao
	 * @since: 2017年10月23日 下午11:05:36  
	 */
	@RequestMapping("/detail")
	@ResponseBody
	public CommonResp<AnswerDetails> detail(String snStamp, String stuId){
		return answerDetailsService.detail(snStamp, stuId);
	}
	
	/**
	 * @Description: 根据心理测试编号查找某一个心理测试答题情况
	 * @author hantao
	 * @date 2017年9月16日 下午10:27:17
	 */
	@RequestMapping("/list")
	@ResponseBody 
	CommonResp<List<AnswerDetailsBo>> list(String snStamp,Integer pageNo) {
		return answerDetailsService.listPage(snStamp, pageNo);
	}
}
